package music;

import graphics.GuitarKeys;

public class Note implements Comparable<Note> {
	private boolean key[];
	private boolean isHit;
	private boolean isMissed;
	private long time;
	private int noOfKeys = 5;

	public Note(long time) {
		this.time = time;
		key = new boolean[noOfKeys];
		for (int i = 0; i < noOfKeys; i++)
			key[i] = false;
	}

	public boolean isSet(int i) {
		return key[i];
	}

	public void set(int i) {
		key[i] = true;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public void hit() {
		// TODO Auto-generated method stub
		isHit = true;
	}

	public void missed() {
		// TODO Auto-generated method stub
		isMissed = true;
	}

	public boolean isHit() {
		return isHit;
	}

	public boolean isMissed() {
		return isMissed;
	}

	public int compareTo(Note arg0) {
		Integer i1 = new Integer((int) time);
		Integer i2 = new Integer((int) arg0.time);
		return i1.compareTo(i2);
	}

	public boolean check(GuitarKeys guitarKeys) {
		for (int i = 0; i < guitarKeys.getNoOfKeys(); i++)
			if (key[i] != guitarKeys.getKey(i))
				return false;
		return true;
	}
}
